<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class RBS::Prototype::RBI - rbs: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-call_node-3F">#call_node?</a>
    <li ><a href="#method-i-const_to_name">#const_to_name</a>
    <li ><a href="#method-i-current_module">#current_module</a>
    <li ><a href="#method-i-current_module-21">#current_module!</a>
    <li ><a href="#method-i-current_namespace">#current_namespace</a>
    <li ><a href="#method-i-each_arg">#each_arg</a>
    <li ><a href="#method-i-each_child">#each_child</a>
    <li ><a href="#method-i-join_comments">#join_comments</a>
    <li ><a href="#method-i-method_type">#method_type</a>
    <li ><a href="#method-i-nested_name">#nested_name</a>
    <li ><a href="#method-i-node_to_hash">#node_to_hash</a>
    <li ><a href="#method-i-parse">#parse</a>
    <li ><a href="#method-i-parse_params">#parse_params</a>
    <li ><a href="#method-i-pop_sig">#pop_sig</a>
    <li ><a href="#method-i-proc_type-3F">#proc_type?</a>
    <li ><a href="#method-i-process">#process</a>
    <li ><a href="#method-i-push_class">#push_class</a>
    <li ><a href="#method-i-push_module">#push_module</a>
    <li ><a href="#method-i-push_sig">#push_sig</a>
    <li ><a href="#method-i-type_of">#type_of</a>
    <li ><a href="#method-i-type_of0">#type_of0</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-RBS::Prototype::RBI">
    <h1 id="class-RBS::Prototype::RBI" class="class">
      class RBS::Prototype::RBI
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-decls" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">decls</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-last_sig" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">last_sig</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-modules" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">modules</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 10</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
  <span class="ruby-ivar">@decls</span> = []

  <span class="ruby-ivar">@modules</span> = []
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-call_node-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">call_node?</span><span
                                class="method-args">(node, name:, receiver: -&gt; (node) { node.type == :CONST &amp;&amp; node.children[0] == :T }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="call_node-3F-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 546</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">call_node?</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">name:</span>, <span class="ruby-value">receiver:</span> <span class="ruby-operator">-&gt;</span> (<span class="ruby-identifier">node</span>) { <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:CONST</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:T</span> }, <span class="ruby-value">args:</span> <span class="ruby-operator">-&gt;</span> (<span class="ruby-identifier">node</span>) { <span class="ruby-keyword">true</span> })
  <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:CALL</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">receiver</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-const_to_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">const_to_name</span><span
                                class="method-args">(node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="const_to_name-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 550</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">const_to_name</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:CONST</span>
    <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">empty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:COLON2</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
      <span class="ruby-identifier">namespace</span> = <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">to_namespace</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">namespace</span> = <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">empty</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">type_name</span> = <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>], <span class="ruby-value">namespace:</span> <span class="ruby-identifier">namespace</span>)

    <span class="ruby-keyword">case</span> <span class="ruby-identifier">type_name</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;T::Array&quot;</span>
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>.<span class="ruby-identifier">name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;T::Hash&quot;</span>
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Hash</span>.<span class="ruby-identifier">name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;T::Range&quot;</span>
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Range</span>.<span class="ruby-identifier">name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;T::Enumerator&quot;</span>
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Enumerator</span>.<span class="ruby-identifier">name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;T::Enumerable&quot;</span>
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Enumerable</span>.<span class="ruby-identifier">name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;T::Set&quot;</span>
      <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">Set</span>.<span class="ruby-identifier">name</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">type_name</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:COLON3</span>
    <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">root</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unexpected node type: #{node.type}&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-current_module" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">current_module</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="current_module-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 90</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">current_module</span>
  <span class="ruby-identifier">modules</span>.<span class="ruby-identifier">last</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-current_module-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">current_module!</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="current_module-21-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 94</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">current_module!</span>
  <span class="ruby-identifier">current_module</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-current_namespace" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">current_namespace</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="current_namespace-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 46</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">current_namespace</span>
  <span class="ruby-identifier">modules</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">empty</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">parent</span>, <span class="ruby-identifier">mod</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">parent</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_namespace</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-each_arg" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">each_arg</span><span
                                class="method-args">(array) { |arg| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="each_arg-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 586</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each_arg</span>(<span class="ruby-identifier">array</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">array</span>&amp;.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:ARRAY</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">array</span>&amp;.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:LIST</span>
      <span class="ruby-identifier">array</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span>
          <span class="ruby-keyword">yield</span> <span class="ruby-identifier">arg</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">enum_for</span> <span class="ruby-value">:each_arg</span>, <span class="ruby-identifier">array</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-each_child" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">each_child</span><span
                                class="method-args">(node) { |child| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="each_child-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 600</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each_child</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">RubyVM</span><span class="ruby-operator">::</span><span class="ruby-constant">AbstractSyntaxTree</span><span class="ruby-operator">::</span><span class="ruby-constant">Node</span>)
      <span class="ruby-keyword">yield</span> <span class="ruby-identifier">child</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-join_comments" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">join_comments</span><span
                                class="method-args">(nodes, comments)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="join_comments-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 112</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">join_comments</span>(<span class="ruby-identifier">nodes</span>, <span class="ruby-identifier">comments</span>)
  <span class="ruby-identifier">cs</span> = <span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span> <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] }.<span class="ruby-identifier">compact</span>
  <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Comment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">string:</span> <span class="ruby-identifier">cs</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:string</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>), <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-method_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">method_type</span><span
                                class="method-args">(args_node, type_node, variables:, overloads:)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="method_type-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 278</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">method_type</span>(<span class="ruby-identifier">args_node</span>, <span class="ruby-identifier">type_node</span>, <span class="ruby-value">variables:</span>, <span class="ruby-value">overloads:</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">type_node</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:CALL</span>
      <span class="ruby-identifier">method_type</span> = <span class="ruby-identifier">method_type</span>(<span class="ruby-identifier">args_node</span>, <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>, <span class="ruby-value">overloads:</span> <span class="ruby-identifier">overloads</span>) <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">method_type</span> = <span class="ruby-constant">MethodType</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span>.<span class="ruby-identifier">empty</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)),
        <span class="ruby-value">block:</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-value">type_params:</span> []
      )
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">name</span>, <span class="ruby-identifier">args</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">type</span>
                 <span class="ruby-keyword">when</span> <span class="ruby-value">:CALL</span>
                   [
                     <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>],
                     <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]
                   ]
                 <span class="ruby-keyword">when</span> <span class="ruby-value">:FCALL</span>, <span class="ruby-value">:VCALL</span>
                   [
                     <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>],
                     <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>]
                   ]
                 <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">case</span> <span class="ruby-identifier">name</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:returns</span>
      <span class="ruby-identifier">return_type</span> = <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">to_a</span>[<span class="ruby-value">0</span>]
      <span class="ruby-identifier">method_type</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">method_type</span>.<span class="ruby-identifier">type</span>.<span class="ruby-identifier">with_return_type</span>(<span class="ruby-identifier">type_of</span>(<span class="ruby-identifier">return_type</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>)))
    <span class="ruby-keyword">when</span> <span class="ruby-value">:params</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">args_node</span>
        <span class="ruby-identifier">parse_params</span>(<span class="ruby-identifier">args_node</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">method_type</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>, <span class="ruby-value">overloads:</span> <span class="ruby-identifier">overloads</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">vars</span> = (<span class="ruby-identifier">node_to_hash</span>(<span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">to_a</span>[<span class="ruby-value">0</span>]) <span class="ruby-operator">||</span> {}).<span class="ruby-identifier">transform_values</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">type_of</span>(<span class="ruby-identifier">value</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>) }

        <span class="ruby-identifier">required_positionals</span> = <span class="ruby-identifier">vars</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
          <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>)
        <span class="ruby-keyword">end</span>

        <span class="ruby-identifier">method_type</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">method_type</span>.<span class="ruby-identifier">type</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value">required_positionals:</span> <span class="ruby-identifier">required_positionals</span>))
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:type_parameters</span>
      <span class="ruby-identifier">type_params</span> = []

      <span class="ruby-identifier">each_arg</span> <span class="ruby-identifier">args</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:LIT</span>
          <span class="ruby-identifier">type_params</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>

      <span class="ruby-identifier">method_type</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value">type_params:</span> <span class="ruby-identifier">type_params</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:void</span>
      <span class="ruby-identifier">method_type</span>.<span class="ruby-identifier">update</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">method_type</span>.<span class="ruby-identifier">type</span>.<span class="ruby-identifier">with_return_type</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Void</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)))
    <span class="ruby-keyword">when</span> <span class="ruby-value">:proc</span>
      <span class="ruby-identifier">method_type</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">method_type</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-nested_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">nested_name</span><span
                                class="method-args">(name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="nested_name-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 42</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">nested_name</span>(<span class="ruby-identifier">name</span>)
  (<span class="ruby-identifier">current_namespace</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">name</span>).<span class="ruby-identifier">to_namespace</span>).<span class="ruby-identifier">to_type_name</span>.<span class="ruby-identifier">relative!</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-node_to_hash" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">node_to_hash</span><span
                                class="method-args">(node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="node_to_hash-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 608</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">node_to_hash</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">node</span>&amp;.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:HASH</span>
    <span class="ruby-comment"># @type var hash: Hash[Symbol, untyped]</span>
    <span class="ruby-identifier">hash</span> = {}

    <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">each_slice</span>(<span class="ruby-value">2</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">var</span>, <span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">var</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span>

      <span class="ruby-keyword">if</span> <span class="ruby-identifier">var</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:LIT</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">type</span>
        <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">var</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]] = <span class="ruby-identifier">type</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">hash</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-parse" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse</span><span
                                class="method-args">(string)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="parse-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 16</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse</span>(<span class="ruby-identifier">string</span>)
  <span class="ruby-identifier">comments</span> = <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier">lex</span>(<span class="ruby-identifier">string</span>).<span class="ruby-identifier">yield_self</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tokens</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">each</span>.<span class="ruby-identifier">with_object</span>({}) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">token</span>, <span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
      <span class="ruby-comment"># @type var hash: Hash[Integer, AST::Comment]</span>

      <span class="ruby-keyword">if</span> <span class="ruby-identifier">token</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:on_comment</span>
        <span class="ruby-identifier">line</span> = <span class="ruby-identifier">token</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>]
        <span class="ruby-identifier">body</span> = <span class="ruby-identifier">token</span>[<span class="ruby-value">2</span>][<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span>

        <span class="ruby-identifier">body</span> = <span class="ruby-string">&quot;\n&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">empty?</span>

        <span class="ruby-identifier">comment</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Comment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">string:</span> <span class="ruby-identifier">body</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
        <span class="ruby-keyword">if</span> (<span class="ruby-identifier">prev_comment</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">line</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>))
          <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">line</span>] = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Comment</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-value">string:</span> <span class="ruby-identifier">prev_comment</span>.<span class="ruby-identifier">string</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">comment</span>.<span class="ruby-identifier">string</span>,
            <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>
          )
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">line</span>] = <span class="ruby-identifier">comment</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">process</span> <span class="ruby-constant">RubyVM</span><span class="ruby-operator">::</span><span class="ruby-constant">AbstractSyntaxTree</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">string</span>), <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-parse_params" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse_params</span><span
                                class="method-args">(args_node, args, method_type, variables:, overloads:)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="parse_params-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 340</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse_params</span>(<span class="ruby-identifier">args_node</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">method_type</span>, <span class="ruby-value">variables:</span>, <span class="ruby-value">overloads:</span>)
  <span class="ruby-identifier">vars</span> = (<span class="ruby-identifier">node_to_hash</span>(<span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">to_a</span>[<span class="ruby-value">0</span>]) <span class="ruby-operator">||</span> {}).<span class="ruby-identifier">transform_values</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">type_of</span>(<span class="ruby-identifier">value</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>) }

  <span class="ruby-comment"># @type var required_positionals: Array[Types::Function::Param]</span>
  <span class="ruby-identifier">required_positionals</span> = []
  <span class="ruby-comment"># @type var optional_positionals: Array[Types::Function::Param]</span>
  <span class="ruby-identifier">optional_positionals</span> = []
  <span class="ruby-comment"># @type var rest_positionals: Types::Function::Param?</span>
  <span class="ruby-identifier">rest_positionals</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-comment"># @type var trailing_positionals: Array[Types::Function::Param]</span>
  <span class="ruby-identifier">trailing_positionals</span> = []
  <span class="ruby-comment"># @type var required_keywords: Hash[Symbol, Types::Function::Param]</span>
  <span class="ruby-identifier">required_keywords</span> = {}
  <span class="ruby-comment"># @type var optional_keywords: Hash[Symbol, Types::Function::Param]</span>
  <span class="ruby-identifier">optional_keywords</span> = {}
  <span class="ruby-comment"># @type var rest_keywords: Types::Function::Param?</span>
  <span class="ruby-identifier">rest_keywords</span> = <span class="ruby-keyword">nil</span>

  <span class="ruby-identifier">var_names</span> = <span class="ruby-identifier">args_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
  <span class="ruby-identifier">pre_num</span>, <span class="ruby-identifier">_pre_init</span>, <span class="ruby-identifier">opt</span>, <span class="ruby-identifier">_first_post</span>, <span class="ruby-identifier">post_num</span>, <span class="ruby-identifier">_post_init</span>, <span class="ruby-identifier">rest</span>, <span class="ruby-identifier">kw</span>, <span class="ruby-identifier">kwrest</span>, <span class="ruby-identifier">block</span> = <span class="ruby-identifier">args_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">children</span>

  <span class="ruby-identifier">pre_num</span>.<span class="ruby-identifier">times</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">name</span> = <span class="ruby-identifier">var_names</span>[<span class="ruby-identifier">i</span>]
    <span class="ruby-identifier">type</span> = <span class="ruby-identifier">vars</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-identifier">required_positionals</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>, <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">index</span> = <span class="ruby-identifier">pre_num</span>
  <span class="ruby-keyword">while</span> <span class="ruby-identifier">opt</span>
    <span class="ruby-identifier">name</span> = <span class="ruby-identifier">var_names</span>[<span class="ruby-identifier">index</span>]
    <span class="ruby-keyword">if</span> (<span class="ruby-identifier">type</span> = <span class="ruby-identifier">vars</span>[<span class="ruby-identifier">name</span>])
      <span class="ruby-identifier">optional_positionals</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>, <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">index</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">opt</span> = <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>]
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest</span>
    <span class="ruby-identifier">name</span> = <span class="ruby-identifier">var_names</span>[<span class="ruby-identifier">index</span>]
    <span class="ruby-keyword">if</span> (<span class="ruby-identifier">type</span> = <span class="ruby-identifier">vars</span>[<span class="ruby-identifier">name</span>])
      <span class="ruby-identifier">rest_positionals</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>, <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">index</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">post_num</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">name</span> = <span class="ruby-identifier">var_names</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-identifier">index</span>]
    <span class="ruby-keyword">if</span> (<span class="ruby-identifier">type</span> = <span class="ruby-identifier">vars</span>[<span class="ruby-identifier">name</span>])
      <span class="ruby-identifier">trailing_positionals</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>, <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">index</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">while</span> <span class="ruby-identifier">kw</span>
    <span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span> = <span class="ruby-identifier">kw</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">children</span>
    <span class="ruby-keyword">if</span> (<span class="ruby-identifier">type</span> = <span class="ruby-identifier">vars</span>[<span class="ruby-identifier">name</span>])
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>
        <span class="ruby-identifier">optional_keywords</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>, <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">required_keywords</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>, <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">kw</span> = <span class="ruby-identifier">kw</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>]
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">kwrest</span>
    <span class="ruby-identifier">name</span> = <span class="ruby-identifier">kwrest</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
    <span class="ruby-keyword">if</span> (<span class="ruby-identifier">type</span> = <span class="ruby-identifier">vars</span>[<span class="ruby-identifier">name</span>])
      <span class="ruby-identifier">rest_keywords</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>, <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">method_block</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">block</span>
    <span class="ruby-keyword">if</span> (<span class="ruby-identifier">type</span> = <span class="ruby-identifier">vars</span>[<span class="ruby-identifier">block</span>])
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Proc</span>)
        <span class="ruby-identifier">method_block</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Block</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">required:</span> <span class="ruby-keyword">true</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">type</span>, <span class="ruby-value">self_type:</span> <span class="ruby-keyword">nil</span>)
      <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>)
        <span class="ruby-identifier">method_block</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Block</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">required:</span> <span class="ruby-keyword">true</span>,
          <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span>.<span class="ruby-identifier">empty</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)),
          <span class="ruby-value">self_type:</span> <span class="ruby-keyword">nil</span>
        )
      <span class="ruby-comment"># Handle an optional block like `T.nilable(T.proc.void)`.</span>
      <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Optional</span>) <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">proc_type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">type</span>).<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Proc</span>)
        <span class="ruby-identifier">method_block</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Block</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">required:</span> <span class="ruby-keyword">false</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">proc_type</span>.<span class="ruby-identifier">type</span>, <span class="ruby-value">self_type:</span> <span class="ruby-keyword">nil</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Unexpected block type: #{type}&quot;</span>
        <span class="ruby-constant">PP</span>.<span class="ruby-identifier">pp</span> <span class="ruby-identifier">args_node</span>, <span class="ruby-constant">STDERR</span>
        <span class="ruby-identifier">method_block</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Block</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">required:</span> <span class="ruby-keyword">true</span>,
          <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span>.<span class="ruby-identifier">empty</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)),
          <span class="ruby-value">self_type:</span> <span class="ruby-keyword">nil</span>
        )
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">overloads</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
        <span class="ruby-identifier">method_block</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Block</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">required:</span> <span class="ruby-keyword">false</span>,
          <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span>.<span class="ruby-identifier">empty</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)),
          <span class="ruby-value">self_type:</span> <span class="ruby-keyword">nil</span>
        )
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">method_type</span>.<span class="ruby-identifier">update</span>(
    <span class="ruby-value">type:</span> <span class="ruby-identifier">method_type</span>.<span class="ruby-identifier">type</span>.<span class="ruby-identifier">update</span>(
      <span class="ruby-value">required_positionals:</span> <span class="ruby-identifier">required_positionals</span>,
      <span class="ruby-value">optional_positionals:</span> <span class="ruby-identifier">optional_positionals</span>,
      <span class="ruby-value">rest_positionals:</span> <span class="ruby-identifier">rest_positionals</span>,
      <span class="ruby-value">trailing_positionals:</span> <span class="ruby-identifier">trailing_positionals</span>,
      <span class="ruby-value">required_keywords:</span> <span class="ruby-identifier">required_keywords</span>,
      <span class="ruby-value">optional_keywords:</span> <span class="ruby-identifier">optional_keywords</span>,
      <span class="ruby-value">rest_keywords:</span> <span class="ruby-identifier">rest_keywords</span>
    ),
    <span class="ruby-value">block:</span> <span class="ruby-identifier">method_block</span>
  )
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-pop_sig" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">pop_sig</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="pop_sig-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 106</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pop_sig</span>
  <span class="ruby-ivar">@last_sig</span>.<span class="ruby-identifier">tap</span> <span class="ruby-keyword">do</span>
    <span class="ruby-ivar">@last_sig</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-proc_type-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">proc_type?</span><span
                                class="method-args">(type_node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="proc_type-3F-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 538</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">proc_type?</span>(<span class="ruby-identifier">type_node</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:proc</span>)
    <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:CALL</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">proc_type?</span>(<span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>])
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-process" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">process</span><span
                                class="method-args">(node, outer: [], comments:)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="process-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 117</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">process</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">outer:</span> [], <span class="ruby-value">comments:</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:CLASS</span>
    <span class="ruby-identifier">comment</span> = <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
    <span class="ruby-identifier">push_class</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>], <span class="ruby-value">comment:</span> <span class="ruby-identifier">comment</span> <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">process</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>], <span class="ruby-value">outer:</span> <span class="ruby-identifier">outer</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">node</span>], <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:MODULE</span>
    <span class="ruby-identifier">comment</span> = <span class="ruby-identifier">comments</span>[<span class="ruby-identifier">node</span>.<span class="ruby-identifier">first_lineno</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
    <span class="ruby-identifier">push_module</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-value">comment:</span> <span class="ruby-identifier">comment</span> <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">process</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>], <span class="ruby-value">outer:</span> <span class="ruby-identifier">outer</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">node</span>], <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:FCALL</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
    <span class="ruby-keyword">when</span> <span class="ruby-value">:include</span>
      <span class="ruby-identifier">each_arg</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>] <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:CONST</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:COLON2</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:COLON3</span>
          <span class="ruby-identifier">name</span> = <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">arg</span>)
          <span class="ruby-identifier">include_member</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Include</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>,
            <span class="ruby-value">args:</span> [],
            <span class="ruby-value">annotations:</span> [],
            <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>
          )
          <span class="ruby-identifier">current_module!</span>.<span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">include_member</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:extend</span>
      <span class="ruby-identifier">each_arg</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>] <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:CONST</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:COLON2</span>
          <span class="ruby-identifier">name</span> = <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">arg</span>)
          <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;T::Generic&quot;</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;T::Sig&quot;</span>
            <span class="ruby-identifier">member</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Extend</span>.<span class="ruby-identifier">new</span>(
              <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>,
              <span class="ruby-value">args:</span> [],
              <span class="ruby-value">annotations:</span> [],
              <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
              <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>
            )
            <span class="ruby-identifier">current_module!</span>.<span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">member</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:sig</span>
      <span class="ruby-identifier">out</span> = <span class="ruby-identifier">outer</span>.<span class="ruby-identifier">last</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span>
      <span class="ruby-identifier">push_sig</span> <span class="ruby-identifier">out</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">last</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:alias_method</span>
      <span class="ruby-identifier">new</span>, <span class="ruby-identifier">old</span> = <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>] }
      <span class="ruby-identifier">current_module!</span>.<span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Alias</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-value">new_name:</span> <span class="ruby-identifier">new</span>,
        <span class="ruby-value">old_name:</span> <span class="ruby-identifier">old</span>,
        <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-value">annotations:</span> [],
        <span class="ruby-value">kind:</span> <span class="ruby-value">:instance</span>,
        <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>
      )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:DEFS</span>
    <span class="ruby-identifier">sigs</span> = <span class="ruby-identifier">pop_sig</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">sigs</span>
      <span class="ruby-identifier">comment</span> = <span class="ruby-identifier">join_comments</span>(<span class="ruby-identifier">sigs</span>, <span class="ruby-identifier">comments</span>)

      <span class="ruby-identifier">args</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]
      <span class="ruby-identifier">types</span> = <span class="ruby-identifier">sigs</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">sig</span><span class="ruby-operator">|</span> <span class="ruby-identifier">method_type</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">sig</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">current_module!</span>.<span class="ruby-identifier">type_params</span>, <span class="ruby-value">overloads:</span> <span class="ruby-identifier">sigs</span>.<span class="ruby-identifier">size</span>) }.<span class="ruby-identifier">compact</span>

      <span class="ruby-identifier">current_module!</span>.<span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>],
        <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-value">annotations:</span> [],
        <span class="ruby-value">overloads:</span> <span class="ruby-identifier">types</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span><span class="ruby-operator">::</span><span class="ruby-constant">Overload</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">annotations:</span> [], <span class="ruby-value">method_type:</span> <span class="ruby-identifier">type</span>) },
        <span class="ruby-value">kind:</span> <span class="ruby-value">:singleton</span>,
        <span class="ruby-value">comment:</span> <span class="ruby-identifier">comment</span>,
        <span class="ruby-value">overloading:</span> <span class="ruby-keyword">false</span>,
        <span class="ruby-value">visibility:</span> <span class="ruby-keyword">nil</span>
      )
    <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:DEFN</span>
    <span class="ruby-identifier">sigs</span> = <span class="ruby-identifier">pop_sig</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">sigs</span>
      <span class="ruby-identifier">comment</span> = <span class="ruby-identifier">join_comments</span>(<span class="ruby-identifier">sigs</span>, <span class="ruby-identifier">comments</span>)

      <span class="ruby-identifier">args</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>]
      <span class="ruby-identifier">types</span> = <span class="ruby-identifier">sigs</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">sig</span><span class="ruby-operator">|</span> <span class="ruby-identifier">method_type</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">sig</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">current_module!</span>.<span class="ruby-identifier">type_params</span>, <span class="ruby-value">overloads:</span> <span class="ruby-identifier">sigs</span>.<span class="ruby-identifier">size</span>) }.<span class="ruby-identifier">compact</span>

      <span class="ruby-identifier">current_module!</span>.<span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>],
        <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-value">annotations:</span> [],
        <span class="ruby-value">overloads:</span> <span class="ruby-identifier">types</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span><span class="ruby-operator">::</span><span class="ruby-constant">Overload</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">annotations:</span> [], <span class="ruby-value">method_type:</span> <span class="ruby-identifier">type</span>) },
        <span class="ruby-value">kind:</span> <span class="ruby-value">:instance</span>,
        <span class="ruby-value">comment:</span> <span class="ruby-identifier">comment</span>,
        <span class="ruby-value">overloading:</span> <span class="ruby-keyword">false</span>,
        <span class="ruby-value">visibility:</span> <span class="ruby-keyword">nil</span>
      )
    <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:CDECL</span>
    <span class="ruby-keyword">if</span> (<span class="ruby-identifier">send</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">last</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">send</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:FCALL</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">send</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:type_member</span>
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">send</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:HASH</span> <span class="ruby-operator">&amp;&amp;</span>
          <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">each_slice</span>(<span class="ruby-value">2</span>).<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">_</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:LIT</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:fixed</span> }
      }
        <span class="ruby-comment"># @type var variance: AST::TypeParam::variance?</span>
        <span class="ruby-keyword">if</span> (<span class="ruby-identifier">a0</span> = <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">send</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">to_a</span>[<span class="ruby-value">0</span>]) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">a0</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:LIT</span>
          <span class="ruby-identifier">variance</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">a0</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
                     <span class="ruby-keyword">when</span> <span class="ruby-value">:out</span>
                       <span class="ruby-value">:covariant</span>
                     <span class="ruby-keyword">when</span> <span class="ruby-value">:in</span>
                       <span class="ruby-value">:contravariant</span>
                     <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>

        <span class="ruby-identifier">current_module!</span>.<span class="ruby-identifier">type_params</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">TypeParam</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>],
          <span class="ruby-value">variance:</span> <span class="ruby-identifier">variance</span> <span class="ruby-operator">||</span> <span class="ruby-value">:invariant</span>,
          <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">upper_bound:</span> <span class="ruby-keyword">nil</span>
        )
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">name</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">yield_self</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
          <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">namespace:</span> <span class="ruby-identifier">current_namespace</span>, <span class="ruby-value">name:</span> <span class="ruby-identifier">n</span>)
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">n</span>)
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">value_node</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>.<span class="ruby-identifier">last</span>
      <span class="ruby-identifier">type</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">value_node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:CALL</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">value_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:let</span>
               <span class="ruby-identifier">type_node</span> = <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">value_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_a</span>[<span class="ruby-value">1</span>]
               <span class="ruby-identifier">type_of</span> <span class="ruby-identifier">type_node</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">current_module</span>&amp;.<span class="ruby-identifier">type_params</span> <span class="ruby-operator">||</span> []
             <span class="ruby-keyword">else</span>
               <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
             <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Constant</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>,
        <span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>,
        <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>
      )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:ALIAS</span>
    <span class="ruby-identifier">current_module!</span>.<span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Alias</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">new_name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>],
      <span class="ruby-value">old_name:</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>],
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">annotations:</span> [],
      <span class="ruby-value">kind:</span> <span class="ruby-value">:instance</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>
    )
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">each_child</span> <span class="ruby-identifier">node</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">process</span> <span class="ruby-identifier">child</span>, <span class="ruby-value">outer:</span> <span class="ruby-identifier">outer</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">node</span>], <span class="ruby-value">comments:</span> <span class="ruby-identifier">comments</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-push_class" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">push_class</span><span
                                class="method-args">(name, super_class, comment:) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="push_class-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 52</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">push_class</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">super_class</span>, <span class="ruby-value">comment:</span>)
  <span class="ruby-identifier">class_decl</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>(
    <span class="ruby-value">name:</span> <span class="ruby-identifier">nested_name</span>(<span class="ruby-identifier">name</span>),
    <span class="ruby-value">super_class:</span> <span class="ruby-identifier">super_class</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span><span class="ruby-operator">::</span><span class="ruby-constant">Super</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">super_class</span>), <span class="ruby-value">args:</span> [], <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>),
    <span class="ruby-value">type_params:</span> [],
    <span class="ruby-value">members:</span> [],
    <span class="ruby-value">annotations:</span> [],
    <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
    <span class="ruby-value">comment:</span> <span class="ruby-identifier">comment</span>
  )

  <span class="ruby-identifier">modules</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">class_decl</span>
  <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">class_decl</span>

  <span class="ruby-keyword">yield</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-identifier">modules</span>.<span class="ruby-identifier">pop</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-push_module" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">push_module</span><span
                                class="method-args">(name, comment:) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="push_module-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 71</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">push_module</span>(<span class="ruby-identifier">name</span>, <span class="ruby-value">comment:</span>)
  <span class="ruby-identifier">module_decl</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Module</span>.<span class="ruby-identifier">new</span>(
    <span class="ruby-value">name:</span> <span class="ruby-identifier">nested_name</span>(<span class="ruby-identifier">name</span>),
    <span class="ruby-value">type_params:</span> [],
    <span class="ruby-value">members:</span> [],
    <span class="ruby-value">annotations:</span> [],
    <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
    <span class="ruby-value">self_types:</span> [],
    <span class="ruby-value">comment:</span> <span class="ruby-identifier">comment</span>
  )

  <span class="ruby-identifier">modules</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">module_decl</span>
  <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">module_decl</span>

  <span class="ruby-keyword">yield</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-identifier">modules</span>.<span class="ruby-identifier">pop</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-push_sig" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">push_sig</span><span
                                class="method-args">(node)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="push_sig-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 98</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">push_sig</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">last_sig</span> = <span class="ruby-ivar">@last_sig</span>
    <span class="ruby-identifier">last_sig</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">node</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@last_sig</span> = [<span class="ruby-identifier">node</span>]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-type_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">type_of</span><span
                                class="method-args">(type_node, variables:)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="type_of-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 461</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">type_of</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">variables:</span>)
  <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type_of0</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>)

  <span class="ruby-keyword">case</span>
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstance</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-constant">BuiltinNames</span><span class="ruby-operator">::</span><span class="ruby-constant">BasicObject</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">name</span>
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstance</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;T::Boolean&quot;</span>
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Bool</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">type</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-type_of0" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">type_of0</span><span
                                class="method-args">(type_node, variables:)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="type_of0-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/rbi.rb, line 474</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">type_of0</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">variables:</span>)
  <span class="ruby-keyword">case</span>
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:CONST</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>])
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Variable</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">type_node</span>), <span class="ruby-value">args:</span> [], <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:COLON2</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:COLON3</span>
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">const_to_name</span>(<span class="ruby-identifier">type_node</span>), <span class="ruby-value">args:</span> [], <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:[]</span>, <span class="ruby-value">receiver:</span> <span class="ruby-operator">-&gt;</span> (<span class="ruby-identifier">_</span>) { <span class="ruby-keyword">true</span> })
    <span class="ruby-comment"># The type_node represents a type application</span>
    <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type_of</span>(<span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>], <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>)
    <span class="ruby-identifier">type</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstance</span>) <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span>

    <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">type</span>.<span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">type_of</span>(<span class="ruby-identifier">arg</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>)
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:type_parameter</span>)
    <span class="ruby-identifier">name</span> = <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_a</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>]
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Variable</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:any</span>)
    <span class="ruby-identifier">types</span> = <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span> <span class="ruby-identifier">type_of</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>) }
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Union</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">types:</span> <span class="ruby-identifier">types</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:all</span>)
    <span class="ruby-identifier">types</span> = <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span> <span class="ruby-identifier">type_of</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>) }
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Intersection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">types:</span> <span class="ruby-identifier">types</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:untyped</span>)
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:nilable</span>)
    <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type_of</span> <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_a</span>[<span class="ruby-value">0</span>], <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Optional</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:self_type</span>)
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:attached_class</span>)
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:noreturn</span>)
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Bottom</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">call_node?</span>(<span class="ruby-identifier">type_node</span>, <span class="ruby-value">name:</span> <span class="ruby-value">:class_of</span>)
    <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type_of</span> <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_a</span>[<span class="ruby-value">0</span>], <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">type</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstance</span>
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassSingleton</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">name</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Unexpected type for `class_of`: #{type}&quot;</span>
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:ARRAY</span>, <span class="ruby-identifier">type_node</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:LIST</span>
    <span class="ruby-identifier">types</span> = <span class="ruby-identifier">each_arg</span>(<span class="ruby-identifier">type_node</span>).<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span> <span class="ruby-identifier">type_of</span>(<span class="ruby-identifier">node</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>) }
    <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Tuple</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">types:</span> <span class="ruby-identifier">types</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">proc_type?</span>(<span class="ruby-identifier">type_node</span>)
      <span class="ruby-identifier">method_type</span> = <span class="ruby-identifier">method_type</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">type_node</span>, <span class="ruby-value">variables:</span> <span class="ruby-identifier">variables</span>, <span class="ruby-value">overloads:</span> <span class="ruby-value">1</span>) <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span>
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">type:</span> <span class="ruby-identifier">method_type</span>.<span class="ruby-identifier">type</span>, <span class="ruby-value">block:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">self_type:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Unexpected type_node:&quot;</span>
      <span class="ruby-constant">PP</span>.<span class="ruby-identifier">pp</span> <span class="ruby-identifier">type_node</span>, <span class="ruby-constant">STDERR</span>
      <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

